﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Entity;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace EFTest
{
    public class ProductContext : DbContext
    {
        public ProductContext()
            : base()
        {

        }

        public DbSet<Category> Categories { set; get; }

        public DbSet<Product> Products { set; get; }

        public DbSet<Supplier> Suppliers { get; set; }


        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Supplier>()
                .Property(s => s.Name)
                .IsRequired();
        }
    }
}